/**
 * @project_name staff_vehicle
 * @package_name com.ssh.ser.admin
 * @desc TODO
 * @param
 * @author jack
 * @date 2013-4-25
 * @time 下午5:57:30
 */
package com.ssh.ser.admin;

import java.util.List;

import com.ssh.dao.PositionDAOI;
import com.ssh.dao.StaffDAOI;
import com.ssh.entity.Position;
import com.ssh.entity.Staff;
import com.ssh.model.pdata.InnerDiverMPData;
import com.ssh.model.pdata.StaffMPData;

/**
 * @author jack
 * @desc 管理员对员工的管理 的接口实现
 */
public class StaffManageSerImpl implements StaffManageSerI {

	private StaffDAOI staffDAOI ;
	private PositionDAOI positionDAOI ;


	/* (non-Javadoc)
	 * @see com.ssh.ser.admin.StaffManageSerI#addStaff(com.ssh.entity.Staff)
	 */
	@Override
	public Staff addStaff(Staff staff) {
		// TODO Auto-generated method stub
		try{
			staffDAOI.addStaff(staff);
		}
		catch(Exception e){
			return null;
		}

		return staff;
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.admin.StaffManageSerI#deleteStaff(java.lang.String)
	 */
	@Override
	public int deleteStaff(String staffId) {
		// TODO Auto-generated method stub
		try{
			staffDAOI.deleteStaffByStaffId(staffId);
		}
		catch(Exception e){
			return 0;
		}
		return 1;
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.admin.StaffManageSerI#viewStaff(java.lang.String)
	 */
	@Override
	public List<Staff> viewStaff(String param) {
		// TODO Auto-generated method stub
		try{
			return  null;
		}
		catch(Exception e){
			return null;
		}

	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.admin.StaffManageSerI#viewById(java.lang.String)
	 */
	@Override
	public Staff viewById(String staffId) {
		// TODO Auto-generated method stub
		try{
			return  staffDAOI.queryStaffByStaffId(staffId);
		}
		catch(Exception e){
			return null;
		}

	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.admin.StaffManageSerI#editById(com.ssh.entity.Staff)
	 */
	@Override
	public Staff editStaff(Staff staff) {
		// TODO Auto-generated method stub
		try{
			return staffDAOI.updateStaff(staff);
		}
		catch(Exception e){
			e.printStackTrace();
			return null;
		}

	}

	/**
	 * @return the staffDAOI
	 */
	public StaffDAOI getStaffDAOI() {
		return staffDAOI;
	}

	/**
	 * @param staffDAOI the staffDAOI to set
	 */
	public void setStaffDAOI(StaffDAOI staffDAOI) {
		this.staffDAOI = staffDAOI;
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.admin.StaffManageSerI#viewStaff(java.lang.String, java.lang.String)
	 */
	@Override
	public List<Staff> viewStaff(String sex, String dep) {
		// TODO Auto-generated method stub
		staffDAOI.queryBySexDep(sex, dep);

		return null;
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.admin.StaffManageSerI#viewStaffMPData(java.lang.String)
	 */
	@Override
	public List<StaffMPData> viewStaffMPDataSex(String sex) {
		// TODO Auto-generated method stub
		return staffDAOI.queryBySex(sex);
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.admin.StaffManageSerI#viewStaffMpData(java.lang.String, java.lang.String)
	 */
	@Override
	public List<StaffMPData> viewStaffMpData(String sex, String dep) {
		// TODO Auto-generated method stub
		return staffDAOI.queryBySexDep(sex, dep);
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.admin.StaffManageSerI#viewAllStaffMPData()
	 */
	@Override
	public List<StaffMPData> viewAllStaffMPData() {
		// TODO Auto-generated method stub
		return staffDAOI.getAllStaffMPData();
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.admin.StaffManageSerI#viewStaffMPDataDep(java.lang.String)
	 */
	@Override
	public List<StaffMPData> viewStaffMPDataDep(String dep) {
		// TODO Auto-generated method stub
		return staffDAOI.queryByDep(dep);
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.admin.StaffManageSerI#viewStaffMPDataById()
	 */
	@SuppressWarnings("unchecked")
	@Override
	public StaffMPData viewStaffMPDataById(String staffId) {
		// TODO Auto-generated method stub
		return (StaffMPData) staffDAOI.querySMPDataById(staffId);
	}

	@Override
	public Position getPosByName(String depName) {
		// TODO Auto-generated method stub
		return positionDAOI.queryPosition(depName);
	}

	/**
	 * @return the positionDAOI
	 */
	public PositionDAOI getPositionDAOI() {
		return positionDAOI;
	}

	/**
	 * @param positionDAOI the positionDAOI to set
	 */
	public void setPositionDAOI(PositionDAOI positionDAOI) {
		this.positionDAOI = positionDAOI;
	}

	@Override
	public List<InnerDiverMPData> getAllInnerDriver() {
		// TODO Auto-generated method stub
		return staffDAOI.queryAllInnerDriver();
	}

	@Override
	public List<InnerDiverMPData> getInnerDriverByState(String state) {
		// TODO Auto-generated method stub
		return staffDAOI.queryInnerDriverByState(state);
	}
	@Override
	public InnerDiverMPData getInnerDriverById(String staffId) {
		// TODO Auto-generated method stub
		return staffDAOI.queryInnerDById(staffId);
	}

}
